package com.tionsy.springbootshiro.service;

import com.tionsy.springbootshiro.entity.RoleEntity;
import com.tionsy.springbootshiro.entity.RoleMenuEntity;
import com.tionsy.springbootshiro.repository.RoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author tiany
 * @date 2018/10/31 10:50
 */
@Service
@Transactional
public class RoleService {
    @Autowired
    private RoleMapper roleMapper;

    public List<RoleEntity> getRolesByUserId(String userId){
        return  roleMapper.getRolesByUserId(userId);
    }

    public List<RoleEntity> getAllRoles(String roleName,String remark){
        return roleMapper.getAllRoles(roleName,remark);
    }

    public int batchInsertRoleMenu(List<RoleMenuEntity> roleMenus){
       return roleMapper.batchInsertRoleMenu(roleMenus);
    }
}

